﻿<?xml version="1.0" encoding="utf-8" ?>
<!-- Application用VC++プロジェクト生成用レシピ -->
<Recipe Name="CreateApplicationVCPPProject" Bound="false" xmlns="http://schemas.microsoft.com/pag/gax-core">
  <Types>
    <TypeAlias Name="Evaluator" Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" />
  </Types>
  <Caption>Create Application VC++ Project</Caption>
  <HostData>
    <Icon ID="680"/>
    <CommandBar Name="Solution Folder"/>
  </HostData>
  <Arguments>
    <Argument Name="ProjectName" Type="System.String">
    </Argument>
    <Argument Name="StrategyArgorithmName" Type="System.String" />
<!--    <Argument Name="StateClassName" Type="System.String" Required="false" /> -->
    <Argument Name="IncDirs" Type="System.String[]">
      <ValueProvider Type="EEst.SoftwareFactory.ValueProviders.CoreIncDirsForAppValueProvider, PathfinderSoftwareFactory"
             />
    </Argument>
    <Argument Name="FileProvider" Type="EEst.SoftwareFactory.ValueProviders.VCPPProjectFileProvider, PathfinderSoftwareFactory">
      <ValueProvider Type="EEst.SoftwareFactory.ValueProviders.GenAppFilesValueProvider, PathfinderSoftwareFactory"
             />
    </Argument>
    <Argument Name="SrcFiles" Type="System.String[]">
      <ValueProvider Type="Evaluator"
         Expression="$(FileProvider.SourceFiles)" />
    </Argument>
    <Argument Name="HdrFiles" Type="System.String[]">
      <ValueProvider Type="Evaluator"
         Expression="$(FileProvider.HeaderFiles)" />
    </Argument>
    <Argument Name="CurrentFolder" Type="EnvDTE.Project, EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.FirstSelectedProject, Microsoft.Practices.RecipeFramework.Library" />
    </Argument>
    <Argument Name="SourceFileType">
      <ValueProvider Type="Evaluator" Expression="Source"/>
    </Argument>
    <Argument Name="HeaderFileType">
      <ValueProvider Type="Evaluator" Expression="Header"/>
    </Argument>
    <Argument Name="ProjectType">
      <ValueProvider Type="Evaluator" Expression="Application"/>
    </Argument>
    <Argument Name="InitAppClassType">
      <ValueProvider Type="Evaluator" Expression="InitApp"/>
    </Argument>
    <Argument Name="TermAppClassType">
      <ValueProvider Type="Evaluator" Expression="TermApp"/>
    </Argument>
    <Argument Name="RunAppClassType">
      <ValueProvider Type="Evaluator" Expression="RunApp"/>
    </Argument>
    <Argument Name="NumOfPathRecognizerArgorithms" Type="System.String" />
    <Argument Name="NumOfDriveControlArgorithms" Type="System.String" />
    <Argument Name="XCConfigFileName">
      <ValueProvider Type="Evaluator" Expression="XCConfig.xml"/>
    </Argument>
    <Argument Name="VS" Type="EnvDTE.DTE, EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <ValueProvider Type="EEst.SoftwareFactory.ValueProviders.EnvDTEValueProvider, PathfinderSoftwareFactory"/>
    </Argument>
    <Argument Name="VSVersion" Type="System.String">
      <ValueProvider Type="Evaluator" Expression="$(VS.Version)"></ValueProvider>
    </Argument>
    <Argument Name="RelativePath" Type="System.String">
      <ValueProvider Type="Evaluator" Expression=".\..\..\"/>
    </Argument>
    <Argument Name="AppPath" Type="System.String">
      <ValueProvider Type="Evaluator" Expression="..\."/>
    </Argument>
    <Argument Name="WheelMotorPort" Type="System.String"></Argument>
    <Argument Name="SteeringMotorPort" Type="System.String"></Argument>
    <Argument Name="LightSensorPort" Type="System.String"></Argument>
    <Argument Name="TouchSensorPort" Type="System.String"></Argument>
    <Argument Name="StartupCodeFileName">
      <ValueProvider Type="Evaluator" Expression="Startup.cpp"/>
    </Argument>
    <Argument Name="PCStartupHCodeFileName">
      <ValueProvider Type="Evaluator" Expression="PCStartup.h"/>
    </Argument>
    <Argument Name="PCStartupCPPCodeFileName">
      <ValueProvider Type="Evaluator" Expression="PCStartup.cpp"/>
    </Argument>
    <Argument Name="PCStartupClassName">
      <ValueProvider Type="Evaluator" Expression="PCStartup"/>
    </Argument>
  </Arguments>
  <GatheringServiceData>
    <Wizard xmlns="http://schemas.microsoft.com/pag/gax-wizards" SchemaVersion="1.0">
      <Pages>
        <Page>
          <Title>Specify Application Project Name</Title>
          <Fields>
            <Field Label="Application Project Name" ValueName="ProjectName"/>
          </Fields>
        </Page>
        <Page>
          <Title>Specify Dependent Strategy Argorithm</Title>
          <Fields>
            <Field Label="Strategy Project Name" ValueName="StrategyArgorithmName" />
            <Field Label="Number of PathRecognizer Argoritms" ValueName="NumOfPathRecognizerArgorithms" />
            <Field Label="Number of DriveControl Argoritms" ValueName="NumOfDriveControlArgorithms" />
  <!--          <Field Label="StateClassName" ValueName="StateClassName" /> -->
          </Fields>
        </Page>
        <Page>
          <Title>Robot Ports Configuration</Title>
          <Fields>
            <Field Label="Wheel Motor Port [A-C]" ValueName="WheelMotorPort" />
            <Field Label="Steering Motor Port [A-C]" ValueName="SteeringMotorPort" />
            <Field Label="Touch Sensor Port [S1-S3]" ValueName="TouchSensorPort" />
            <Field Label="Light Sensor Port [S1-S3]" ValueName="LightSensorPort" />
          </Fields>
        </Page>
      </Pages>
    </Wizard>
  </GatheringServiceData>
  <Actions>
    <!-- VC++ Project Fileの生成及びSolutionへの追加 -->
    <Action Name="ItemContent"
            Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library"
            Template="Text\VCProjExt.vcproj.t4">
      <Input Name="ProjectName" RecipeArgument="ProjectName"/>
      <Input Name="IncDirs" RecipeArgument="IncDirs" />
      <Input Name="Sources" RecipeArgument="SrcFiles" />
      <Input Name="Headers" RecipeArgument="HdrFiles" />
      <Input Name="Version" RecipeArgument="VSVersion" />
      <Output Name="Content" />
    </Action>
    <Action Name="CreateVCPPProjFile" Type="EEst.SoftwareFactory.Actions.CreateVCPProjectByT4Action, PathfinderSoftwareFactory">
      <Input Name="ProjectName" RecipeArgument="ProjectName"/>
      <Input Name="FileContent" ActionOutput="ItemContent.Content"/>
      <Output Name="ProjectFileName"/>
      <Output Name="TargetFolder"/>
    </Action>
    <Action Name="AddProjFileToSolution" Type="EEst.SoftwareFactory.Actions.AddProjectToSolutionFolderAction, PathfinderSoftwareFactory">
      <Input Name="SolutionProject" ActionOutput="CreateVCPPProjFile.TargetFolder"/>
      <Input Name="ProjectFile" ActionOutput="CreateVCPPProjFile.ProjectFileName"/>
      <Output Name="AddedProject"/>
    </Action>
    <Action Name="GetXCConfig" Type="EEst.SoftwareFactory.Actions.GetXCConfigAction, PathfinderSoftwareFactory">
      <Output Name="CygwinHome"/>
      <Output Name="BrickOSHome"/>
      <Output Name="H8ToolsHome"/>
    </Action>
    <Action Name="XCConfigXMLFileContent" Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library"
    Template="Text\XCConfig.xml.t4">
      <Input Name="CygwinHome" ActionOutput="GetXCConfig.CygwinHome"/>
      <Input Name="BrickOSHome" ActionOutput="GetXCConfig.BrickOSHome"/>
      <Input Name="H8ToolsHome" ActionOutput="GetXCConfig.H8ToolsHome"/>
      <Input Name="TargetName" RecipeArgument="ProjectName"/>
      <Input Name="RelativePath" RecipeArgument="RelativePath"/>
      <Input Name="AppPath" RecipeArgument="AppPath"/>
      <Output Name="Content"/>
    </Action>
    <Action Name="AddXCConfigXMLFile" Type="Microsoft.Practices.RecipeFramework.Library.Actions.AddItemFromStringAction, Microsoft.Practices.RecipeFramework.Library">
      <Input Name="Project" ActionOutput="AddProjFileToSolution.AddedProject" />
      <Input Name="Content" ActionOutput="XCConfigXMLFileContent.Content"/>
      <Input Name="TargetFileName" RecipeArgument="XCConfigFileName"/>
    </Action>
    <!-- InitAppクラスのファイル名を取得 -->
    <Action Name="GetInitAppFilePolicy" Type="EEst.SoftwareFactory.Actions.AppProjectPolicyAction, PathfinderSoftwareFactory">
      <Input Name="ProjectName" RecipeArgument="ProjectName" />
      <Input Name="ProjectType" RecipeArgument="ProjectType"/>
      <Input Name="ClassType" RecipeArgument="InitAppClassType" />
      <Output Name="SourceFileName"/>
      <Output Name="HeaderFileName"/>
      <Output Name="ClassName"/>
    </Action>
    <!-- InitAppクラスのソースファイル生成とプロジェクトへの追加 -->
    <Action Name="InitAppCPPContent"
    Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library"
    Template="Text\CPPFiles\InitApp.hcpp.t4">
      <Input Name="ClassName" ActionOutput="GetInitAppFilePolicy.ClassName"/>
      <Input Name="FileType" RecipeArgument="SourceFileType" />
      <Input Name="StrategyProjectName" RecipeArgument="StrategyArgorithmName"/>
      <!--     <Input Name="StateClassName" RecipeArgument="StateClassName"/> -->
      <Output Name="Content" />
    </Action>
    <Action Name="AddInitAppSourceToProject" Type="Microsoft.Practices.RecipeFramework.Library.Actions.AddItemFromStringAction, Microsoft.Practices.RecipeFramework.Library">
      <Input Name="Project" ActionOutput="AddProjFileToSolution.AddedProject" />
      <Input Name="Content" ActionOutput="InitAppCPPContent.Content"/>
      <Input Name="TargetFileName" ActionOutput="GetInitAppFilePolicy.SourceFileName" />
    </Action>
    <!-- InitAppクラスのヘッダーファイル生成とプロジェクトへの追加 -->
    <Action Name="InitAppHContent"
    Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library"
    Template="Text\CPPFiles\InitApp.hcpp.t4">
      <Input Name="ClassName" ActionOutput="GetInitAppFilePolicy.ClassName"/>
      <Input Name="FileType" RecipeArgument="HeaderFileType" />
      <Input Name="StrategyProjectName" RecipeArgument="StrategyArgorithmName"/>
      <!--      <Input Name="StateClassName" RecipeArgument="StateClassName"/> -->
      <Output Name="Content" />
    </Action>
    <Action Name="AddInitAppHeaderToProject" Type="Microsoft.Practices.RecipeFramework.Library.Actions.AddItemFromStringAction, Microsoft.Practices.RecipeFramework.Library">
      <Input Name="Project" ActionOutput="AddProjFileToSolution.AddedProject" />
      <Input Name="Content" ActionOutput="InitAppHContent.Content"/>
      <Input Name="TargetFileName" ActionOutput="GetInitAppFilePolicy.HeaderFileName" />
    </Action>
    <!-- TermAppクラスのファイル名を取得 -->
    <Action Name="GetTermAppFilePolicy" Type="EEst.SoftwareFactory.Actions.AppProjectPolicyAction, PathfinderSoftwareFactory">
      <Input Name="ProjectName" RecipeArgument="ProjectName" />
      <Input Name="ProjectType" RecipeArgument="ProjectType"/>
      <Input Name="ClassType" RecipeArgument="TermAppClassType" />
      <Output Name="SourceFileName"/>
      <Output Name="HeaderFileName"/>
      <Output Name="ClassName"/>
    </Action>
    <!-- TermAppクラスのソースファイル生成とプロジェクトへの追加 -->
    <Action Name="TermAppCPPContent"
    Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library"
    Template="Text\CPPFiles\TermApp.hcpp.t4">
      <Input Name="ClassName" ActionOutput="GetTermAppFilePolicy.ClassName"/>
      <Input Name="FileType" RecipeArgument="SourceFileType" />
 <!--     <Input Name="StateClassName" RecipeArgument="StateClassName"/> -->
      <Output Name="Content" />
    </Action>
    <Action Name="AddTermAppSourceToProject" Type="Microsoft.Practices.RecipeFramework.Library.Actions.AddItemFromStringAction, Microsoft.Practices.RecipeFramework.Library">
      <Input Name="Project" ActionOutput="AddProjFileToSolution.AddedProject" />
      <Input Name="Content" ActionOutput="TermAppCPPContent.Content"/>
      <Input Name="TargetFileName" ActionOutput="GetTermAppFilePolicy.SourceFileName" />
    </Action>
    <!-- TermAppクラスのヘッダーファイル生成とプロジェクトへの追加 -->
    <Action Name="TermAppHContent"
    Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library"
    Template="Text\CPPFiles\TermApp.hcpp.t4">
      <Input Name="ClassName" ActionOutput="GetTermAppFilePolicy.ClassName"/>
      <Input Name="FileType" RecipeArgument="HeaderFileType" />
<!--      <Input Name="StateClassName" RecipeArgument="StateClassName"/> -->
      <Output Name="Content" />
    </Action>
    <Action Name="AddTermAppHeaderToProject" Type="Microsoft.Practices.RecipeFramework.Library.Actions.AddItemFromStringAction, Microsoft.Practices.RecipeFramework.Library">
      <Input Name="Project" ActionOutput="AddProjFileToSolution.AddedProject" />
      <Input Name="Content" ActionOutput="TermAppHContent.Content"/>
      <Input Name="TargetFileName" ActionOutput="GetTermAppFilePolicy.HeaderFileName" />
    </Action>
    <!-- RunAppクラスのファイル名を取得 -->
    <Action Name="GetRunAppFilePolicy" Type="EEst.SoftwareFactory.Actions.AppProjectPolicyAction, PathfinderSoftwareFactory">
      <Input Name="ProjectName" RecipeArgument="ProjectName" />
      <Input Name="ProjectType" RecipeArgument="ProjectType"/>
      <Input Name="ClassType" RecipeArgument="RunAppClassType" />
      <Output Name="SourceFileName"/>
      <Output Name="HeaderFileName"/>
      <Output Name="ClassName"/>
    </Action>
    <!-- RunAppクラスのソースファイル生成とプロジェクトへの追加 -->
    <Action Name="RunAppCPPContent"
    Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library"
    Template="Text\CPPFiles\RunApp.hcpp.t4">
      <Input Name="ClassName" ActionOutput="GetRunAppFilePolicy.ClassName"/>
      <Input Name="FileType" RecipeArgument="SourceFileType" />
 <!--     <Input Name="StateClassName" RecipeArgument="StateClassName"/> -->
      <Input Name="StrategyProjectName" RecipeArgument="StrategyArgorithmName"/>
      <Output Name="Content" />
    </Action>
    <Action Name="AddRunAppSourceToProject" Type="Microsoft.Practices.RecipeFramework.Library.Actions.AddItemFromStringAction, Microsoft.Practices.RecipeFramework.Library">
      <Input Name="Project" ActionOutput="AddProjFileToSolution.AddedProject" />
      <Input Name="Content" ActionOutput="RunAppCPPContent.Content"/>
      <Input Name="TargetFileName" ActionOutput="GetRunAppFilePolicy.SourceFileName" />
    </Action>
    <!-- RunAppクラスのヘッダーファイル生成とプロジェクトへの追加 -->
    <Action Name="RunAppHContent"
    Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library"
    Template="Text\CPPFiles\RunApp.hcpp.t4">
      <Input Name="ClassName" ActionOutput="GetRunAppFilePolicy.ClassName"/>
      <Input Name="FileType" RecipeArgument="HeaderFileType" />
 <!--     <Input Name="StateClassName" RecipeArgument="StateClassName"/> -->
      <Input Name="StrategyProjectName" RecipeArgument="StrategyArgorithmName"/>
      <Input Name="NumOfPathRecognizerArgorithms" RecipeArgument="NumOfPathRecognizerArgorithms" />
      <Input Name="NumOfDriveControlArgorithms" RecipeArgument="NumOfDriveControlArgorithms" />
      <Output Name="Content" />
    </Action>
    <Action Name="AddRunAppHeaderToProject" Type="Microsoft.Practices.RecipeFramework.Library.Actions.AddItemFromStringAction, Microsoft.Practices.RecipeFramework.Library">
      <Input Name="Project" ActionOutput="AddProjFileToSolution.AddedProject" />
      <Input Name="Content" ActionOutput="RunAppHContent.Content"/>
      <Input Name="TargetFileName" ActionOutput="GetRunAppFilePolicy.HeaderFileName" />
    </Action>
    <!-- Startup Code -->
    <Action Name="StartupCodeContent" Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library"
            Template="Text\CPPFiles\Startup.cpp.t4">
      <Input Name="InitAppClassName" ActionOutput="GetInitAppFilePolicy.ClassName"/>
      <Input Name="RunAppClassName" ActionOutput="GetRunAppFilePolicy.ClassName"/>
      <Input Name="TermAppClassName" ActionOutput="GetTermAppFilePolicy.ClassName"/>
      <Input Name="TouchSensorPort" RecipeArgument="TouchSensorPort" />
      <Input Name="LightSensorPort" RecipeArgument="LightSensorPort" />
      <Input Name="SteeringMotorPort" RecipeArgument="SteeringMotorPort" />
      <Input Name="WheelMotorPort" RecipeArgument="WheelMotorPort" />
      <Input Name="NumOfPathRecognizerArgorithms" RecipeArgument="NumOfPathRecognizerArgorithms" />
      <Input Name="NumOfDriveControlArgorithms" RecipeArgument="NumOfDriveControlArgorithms" />
      <Output Name="Content" />
    </Action>
    <Action Name="AddStartupCodeToProject" Type="Microsoft.Practices.RecipeFramework.Library.Actions.AddItemFromStringAction, Microsoft.Practices.RecipeFramework.Library">
      <Input Name="Project" ActionOutput="AddProjFileToSolution.AddedProject"/>
      <Input Name="Content" ActionOutput="StartupCodeContent.Content"/>
      <Input Name="TargetFileName" RecipeArgument="StartupCodeFileName" />
    </Action>
    <!-- PC Startup Code -->
    <Action Name="PCStartupHCodeContent" Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library"
            Template="Text\CPPFiles\PCStartup.hcpp.t4">
      <Input Name="AppName" RecipeArgument="ProjectName"/>
      <Input Name="ClassName" RecipeArgument="PCStartupClassName"/>
      <Input Name="FileType" RecipeArgument="HeaderFileType" />
      <Input Name="InitAppClassName" ActionOutput="GetInitAppFilePolicy.ClassName"/>
      <Input Name="RunAppClassName" ActionOutput="GetRunAppFilePolicy.ClassName"/>
      <Input Name="TermAppClassName" ActionOutput="GetTermAppFilePolicy.ClassName"/>
      <Input Name="TouchSensorPort" RecipeArgument="TouchSensorPort" />
      <Input Name="LightSensorPort" RecipeArgument="LightSensorPort" />
      <Input Name="SteeringMotorPort" RecipeArgument="SteeringMotorPort" />
      <Input Name="WheelMotorPort" RecipeArgument="WheelMotorPort" />
      <Input Name="NumOfPathRecognizerArgorithms" RecipeArgument="NumOfPathRecognizerArgorithms" />
      <Input Name="NumOfDriveControlArgorithms" RecipeArgument="NumOfDriveControlArgorithms" />
      <Output Name="Content" />
    </Action>
    <Action Name="AddPCStartupHCodeToProject" Type="Microsoft.Practices.RecipeFramework.Library.Actions.AddItemFromStringAction, Microsoft.Practices.RecipeFramework.Library">
      <Input Name="Project" ActionOutput="AddProjFileToSolution.AddedProject"/>
      <Input Name="Content" ActionOutput="PCStartupHCodeContent.Content"/>
      <Input Name="TargetFileName" RecipeArgument="PCStartupHCodeFileName" />
    </Action>
    <Action Name="PCStartupCPPCodeContent" Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library"
            Template="Text\CPPFiles\PCStartup.hcpp.t4">
      <Input Name="AppName" RecipeArgument="ProjectName"/>
      <Input Name="ClassName" RecipeArgument="PCStartupClassName"/>
      <Input Name="FileType" RecipeArgument="SourceFileType" />
      <Input Name="InitAppClassName" ActionOutput="GetInitAppFilePolicy.ClassName"/>
      <Input Name="RunAppClassName" ActionOutput="GetRunAppFilePolicy.ClassName"/>
      <Input Name="TermAppClassName" ActionOutput="GetTermAppFilePolicy.ClassName"/>
      <Input Name="TouchSensorPort" RecipeArgument="TouchSensorPort" />
      <Input Name="LightSensorPort" RecipeArgument="LightSensorPort" />
      <Input Name="SteeringMotorPort" RecipeArgument="SteeringMotorPort" />
      <Input Name="WheelMotorPort" RecipeArgument="WheelMotorPort" />
      <Input Name="NumOfPathRecognizerArgorithms" RecipeArgument="NumOfPathRecognizerArgorithms" />
      <Input Name="NumOfDriveControlArgorithms" RecipeArgument="NumOfDriveControlArgorithms" />
      <Output Name="Content" />
    </Action>
    <Action Name="AddPCStartupCPPCodeToProject" Type="Microsoft.Practices.RecipeFramework.Library.Actions.AddItemFromStringAction, Microsoft.Practices.RecipeFramework.Library">
      <Input Name="Project" ActionOutput="AddProjFileToSolution.AddedProject"/>
      <Input Name="Content" ActionOutput="PCStartupCPPCodeContent.Content"/>
      <Input Name="TargetFileName" RecipeArgument="PCStartupCPPCodeFileName" />
    </Action>
  </Actions>
</Recipe>
